home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / tutor / ansihow.arj / ANSIHOW.BAT next >
DOS Batch File  |  1990-03-06  |  4KB  |  72 lines

  1. ECHO OFF
  2. ECHO    This bat file shows how to use ANSI control codes within bat files to get
  3. ECHO lots of color and special effects.
  4. ECHO  View this file in an ASCII-only editor to see the ansi sequences.
  5. ECHO    An ANSI control code can do lots of things.  Each ANSI code has the same
  6. ECHO basic format.  First is the escape command.  We will show it as ESC in this
  7. ECHO demonstration.  In an ASCII editor, it will appear ^[, and may be entered in
  8. ECHO the batch file by ALT-027.  Next is the "[" character.  Then the parameters.
  9. ECHO Be sure to pay attention to upper and lower case letters in the parameters.
  10. ECHO ---------------------------------------------------------------------
  11. ECHO     To clear the screen and home the cursor:       ESC[2J
  12. ECHO    To locate the cursor to row #, column, *:      ESC[#;*H
  13. ECHO            To move the cursor up # rows:    ESC[#A
  14. ECHO          To move the cursor down # rows:    ESC[#B
  15. ECHO          To move the cursor right # columns:    ESC[#C
  16. ECHO           To move the cursor left # columns:    ESC[#D
  17. ECHO        To store the current cursor position:    ESC[s
  18. ECHO     To return to the stored cursor position:    ESC[u
  19. ECHO -----------------------------------------------------------------------
  20. ECHO    To set a color and attribute:            ESC[#;...;#m
  21. ECHO        where #;...;# is a list of attributes
  22. ECHO -----------------------------------------------------------------------
  23. ECHO    The next page contains a list of attribute values
  24. PAUSE
  25. ECHO     Replace # IN ESC[#;...;#m with the value for the desired
  26. ECHO attribute, separating multiple parameters with a semi-colon.
  27. ECHO -----------------------------------------------------------------------
  28. ECHO    Value        Attribute
  29. ECHO      0        All attributes off (normal white-on-black)
  30. ECHO      1        Bold on (high intensity)
  31. ECHO      4        Underscore on (monochrome display only)
  32. ECHO      5        Blink on
  33. ECHO      7        Reverse video on
  34. ECHO      8        Cancelled on (invisible, not demonstrated)
  35. ECHO -----------------------------------------------------------------------
  36. ECHO     Foreground         Background
  37. ECHO    Value        Value        Color
  38. ECHO     30        40        Black
  39. ECHO     31        41        Red
  40. ECHO     32        42        Green
  41. ECHO     33        43        Yellow
  42. ECHO     34        44        Blue
  43. ECHO     35        45        Magenta
  44. ECHO     36        46        Cyan
  45. ECHO     37        47        White
  46. ECHO -----------------------------------------------------------------------
  47. ECHO Example:  This is Green on Red, Blue on White, Blinking Bright Yellow on Blue.
  48. ECHO 1H
  49. PAUSE
  50. ECHO You can also set the screen size with ANSI codes.  The ESC[=#h sequence sets
  51. ECHO screen modes according to the following table:  
  52. ECHO H        # value       Mode
  53. ECHO        0    40x25 black & white
  54. ECHO        1    40x25 color
  55. ECHO        2    80x25 black & white
  56. ECHO        3    80x25 color
  57. ECHO        4    320x200 color
  58. ECHO        5    320x200 black & white
  59. ECHO        6    640x200 black & white
  60. ECHO        7    Line Wrap On (typeing beyond end of line starts new line)
  61. ECHO 1H
  62. PAUSE
  63. ECHO H=1hThis lets you do lots of
  64. ECHO interesting things with
  65. ECHO your batch files!
  66. ECHO 1H
  67. PAUSE
  68. ECHO =3hHANSI codes can be used by adding them to the text you send to the
  69. ECHO Hdisplay with the ECHO command.
  70. ECHO 1HFor example, a blinking yellow on blue HELLO can be obtained with the line:
  71. ECHO 10H"ECHO ^[[33;44;1;5mHELLO^[[0m"
  72. ECHO 5HWhere " ^[ " is the ESC code (Use ALT-027 in an ASCII editor)